import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

public class autoTest2 {

    public void test2() throws InterruptedException {

        //驱动管理程序下载驱动
        WebDriverManager.edgedriver().setup();
        EdgeOptions options = new EdgeOptions();

        //允许访问所有链接
        options.addArguments("--remote-allow-origins=*");

        //打开浏览器
        WebDriver driver = new EdgeDriver(options);

        //输入百度网址: https://www.baidu.com
        driver.get("https://www.baidu.com");
        Thread.sleep(3000);

        WebElement ele = driver.findElement(By.cssSelector("#kw"));
        //找到输入框, 并输入要搜索的内容"赵露思"
//        driver.findElement(By.cssSelector("#kw")).sendKeys("赵露思");
        ele.sendKeys("你好");
        Thread.sleep(3000);

        //找到百度一下的按钮 并点击
//        driver.findElement(By.cssSelector("#su")).click();
        ele.clear();
        ele.sendKeys("测试...");
//        ele.click();
        Thread.sleep(3000);

        //关闭浏览器
        driver.quit();
    }
}